import { updateTween } from "./etc/Tween";
import { GrowModuleC, GrowModuleData, GrowModuleS } from "./module/GrowModule";
import { GuiModuleC, GuiModuleS } from "./module/GuiModule";
import { LevelModuleC, LevelModuleData, LevelModuleS } from "./module/LevelModule";
import { PickupMoneyModuleC, PickupMoneyModuleData, PickupMoneyModuleS } from "./module/PickupMoneyModule";
import { PlayerModuleC, PlayerModuleData, PlayerModuleS } from "./module/PlayerModule";
import { SoundModuleC, SoundModuleS } from "./module/SoundModule";

@Component
export default class GameLauncher extends mw.Script {
    
    onStart() {
        super.onStart()
        this.onRegisterModule();
        DataStorage.setTemporaryStorage(SystemUtil.isPIE ? true : false);
        this.useUpdate = true
    }

    protected onUpdate(dt: number): void {
        updateTween()
    }

    protected onRegisterModule(): void {
        ModuleService.registerModule(PlayerModuleS, PlayerModuleC, PlayerModuleData)
        ModuleService.registerModule(LevelModuleS, LevelModuleC, LevelModuleData)
        ModuleService.registerModule(PickupMoneyModuleS, PickupMoneyModuleC, PickupMoneyModuleData)
        ModuleService.registerModule(GrowModuleS, GrowModuleC, GrowModuleData)
        ModuleService.registerModule(SoundModuleS, SoundModuleC, null)
        
        ModuleService.registerModule(GuiModuleS, GuiModuleC, null)
    }
}